<template>
	<view class="">
		<navBar navbarTitle="奖杯勋章" showback bgColor="" backdrop="10px"></navBar>
		<view class="nav_bg"></view>
		<view class="main">
			<view class="tab_box">
				<image :src="`${$api.imgURL}/cup/check_${tabActive}.png`" mode="" class="tab_icon"></image>
				<view :class="['tab_item',tabActive==0?'tabActive':'']" @click="tabClick(0)">线上奖杯</view>
				<view :class="['tab_item',tabActive==1?'tabActive':'']" @click="tabClick(1)">线下奖杯</view>
			</view>

			<view :class="['box_container',tabActive==0?'left_radius_none':'right_radius_none']">
				<view class="" v-for="(item,index) in list" :key="index">
					<view class="title_box" >
						<view class="col_icon"></view>
						<text>{{item.name}}</text>
					</view>

					<!-- 大奖杯 -->
					<view class="cup_box">
						<image :src="`${$api.imgURL}/medal_1.png`" mode="widthFix" class="cup_img"></image>
						<view class="cup_title">
							<view class="title_left_box">
								<view class="left_big"></view>
								<view class="left_small"></view>
							</view>
							<text>荣耀之星</text>
							<view class="title_left_box title_right_box">
								<view class="right_big"></view>
								<view class="right_small"></view>
							</view>
						</view>
						<view class="cup_content">获得<text style="color: #FFED9D;">10</text>枚勋章后获得 </view>
						<view class="cup_border"></view>
					</view>

					<!-- 三组奖杯 -->
					<view class="list_box">
						<view class="three_list" v-for="(row,key) in itemList.slice(0, 3)" :key="key">
							<image :src="`${$api.imgURL}${row.url}`" mode=""></image>
							<text>{{row.name}}</text>
						</view>
					</view>
					<!-- 四组 -->
					<view class="list_box">
						<view class="three_list" v-for="(row,key) in itemList.slice(3, 7)" :key="key">
							<image :src="`${$api.imgURL}${row.url}`" mode=""></image>
							<text>{{row.name}}</text>
						</view>
					</view>

				</view>



			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabActive: 0,
				itemList:[
					{
						name:'速达先锋',
						url:'/cup/medal1.png'
					},
					{
						name:'速达先锋',
						url:'/cup/medal2.png'
					},
					{
						name:'安全鹰眼',
						url:'/cup/medal3.png'
					},
					{
						name:'速达先锋',
						url:'/cup/medal4.png'
					},
					{
						name:'速达先锋',
						url:'/cup/medal5.png'
					},
					{
						name:'安全鹰眼',
						url:'/cup/medal6.png'
					},
					{
						name:'当机立断',
						url:'/cup/medal7.png'
					}
				],
				list: [{
						name: '居家安全勋章',
					},
					{
						name: '社会安全勋章',
					},
					{
						name: '消防安全勋章',
					},
					{
						name: '交通安全勋章',
					},
					{
						name: '自然灾害勋章',
					},
					{
						name: '生产安全勋章',
					},
					{
						name: '应急救护勋章',
					},
				],
			}
		},
		methods: {
			tabClick(index) {
				this.tabActive = index
			},
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background: #fff;
	}

	.nav_bg {
		width: 100%;
		height: 300rpx;
		position: fixed;
		top: 0;
		z-index: 0;
	}

	.nav_bg::after {
		width: 180%;
		height: 300rpx;
		position: absolute;
		left: -40%;
		top: 0;
		z-index: -1;
		content: '';
		border-radius: 0 0 50% 50%;
		background: #FBC22D;
	}

	.main {

		position: relative;
		z-index: 2;
	}

	.tab_box {
		display: flex;
		margin: 35rpx 0;
		background: #F7F8FC;
		border-radius: 40rpx 40rpx 0 0;
		align-items: center;
		position: relative;
		height: 100rpx;

		view {
			&:nth-child(1) {
				// margin-right: 20rpx;
			}
		}

		.tab_icon {
			width: 66rpx;
			height: 120rpx;
			position: absolute;
			left: 50%;
			transform: translateX(-50%);
			top: -20rpx;
			z-index: 2;
		}

		.tab_item {
			width: 50%;
			// flex: 1;
			text-align: center;
			border-radius: 40rpx 40rpx 0 0;
			font-size: 32rpx;
			color: #A3ACBF;
			background: #F7F8FC;
			// background: #F7F8FC;
			box-sizing: border-box;
			height: 112rpx;
			line-height: 112rpx;
			font-size: 28rpx;
			position: absolute;

			&:nth-of-type(1) {
				left: 0;
				border-top-right-radius: 0;
			}

			&:nth-of-type(2) {
				border-top-left-radius: 0;
				right: 0;
			}
		}

	}

	.tabActive {
		font-size: 40rpx !important;
		color: #2C2E3D !important;
		background: #FFFFFF !important;
		position: absolute;
		height: 120rpx !important;
		top: -20rpx;

		&:nth-of-type(1) {
			border-top-right-radius: 40rpx !important;
		}

		&:nth-of-type(2) {
			border-top-left-radius: 40rpx !important;
		}
	}

	.box_container {
		background: #fff;
		min-height: 300rpx;
		border-radius: 40rpx 40rpx;
		position: relative;
		z-index: 3;
		top: -40rpx;
		box-sizing: border-box;
		padding: 30rpx;
	}

	.right_radius_none {
		border-top-right-radius: 0 !important;
	}

	.left_radius_none {
		border-top-left-radius: 0 !important;
	}

	.title_box {
		display: flex;
		align-items: center;

		.col_icon {
			width: 6rpx;
			height: 32rpx;
			background: #FBC22D;
			border-radius: 4rpx;
			margin-right: 20rpx;
		}

		text {
			font-weight: 600;
			font-size: 36rpx;
			color: #000000;
		}
	}

	.cup_box {
		width: 326rpx;
		margin: 30rpx auto;
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-bottom: 40rpx;
		

		.cup_img {
			width: 132rpx;
			height: 146rpx;
			position: relative;
			z-index: 1;
		}

		.cup_title {
			font-size: 26rpx;
			margin: 10rpx 0;
			margin-left: 5rpx;
			display: flex;
			justify-content: center;
			align-items: center;

			text {
				margin: 0 10rpx;
			}
		}

		.cup_content {
			font-size: 22rpx;
			color: #5E5E5E;
		}

		.cup_border {
			width: 326rpx;
			height: 222rpx;
			border-radius: 40rpx;
			border: 2rpx solid #FFED9D;
			position: absolute;
			top: 28rpx;
		}

		.title_left_box {
			display: flex;
			flex-direction: column;
			align-items: flex-end;
		}

		.left_big,
		.left_small {
			width: 42rpx;
			height: 5rpx;
			// background: #FBC22D;
			border-top: 10rpx solid #FBC22D;
			border-left: 10rpx solid transparent;
		}

		.right_big,
		.right_small {
			width: 42rpx;
			height: 5rpx;
			border-top: 10rpx solid #FBC22D;
			border-right: 10rpx solid transparent;
		}

		.title_right_box {
			align-items: flex-start;
		}

		.left_small {
			width: 18rpx;
		}

		.right_small {
			width: 18rpx;
		}
	}

	.list_box {
		display: flex;
		justify-content: center;
		margin-top: 30rpx;
		margin-right: 30rpx;
		
		&:last-of-type {
			margin-bottom: 60rpx;
		}

	}

	.three_list {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		margin-right: 30rpx;

		&:last-of-type {
			margin-right: 0rpx;
		}

		image {
			width: 104rpx;
			height: 104rpx;
		}
	}
</style>